#include "HufArc.h"

void print (__HufTree * head, char* i,int flag)
{
	char ed[] = "1";
	char nu[] = "0";
	char* m = (char*) calloc (8,sizeof(char));
	if (i)
		strcat (m,i);
	if (flag == -1)
		strcat (m,nu);
	if (flag == 1)
		strcat (m,ed);
	if (head->left)
		print (head->left,m,-1);
	if (!head->flag)
	{
		printf ("%s ",m);
		printf ("%u %d\n",head->alpha,head->count);
		//system ("pause");
	}
	if (head->right)
		print (head->right,m,1);
}